<template>
  <div class="home-new">
    <homePanel title="好货推荐" sub-title="大牌好货 新品上架">
      <template #right>
        <More to="/"></More>
      </template>
      <!-- 面板内容 -->
      <ul class="goods-list">
        <li v-for="good in goods" :key="good.id">
          <RouterLink :to="`/product/${good.id}`">
            <img :src="good.picture" alt="">
            <p class="name ellipsis">{{good.name}}</p>
            <p class="price">&yen;{{good.price}}</p>
          </RouterLink>
        </li>
      </ul>
    </homePanel>
  </div>
</template>

<script>
import homePanel from './home-panel.vue'
import { findNew } from '@/api/home.js'
import { ref } from 'vue'
export default {
  name: 'homeNew',
  components: {
    homePanel
  },
  setup () {
    const goods = ref([])
    findNew().then(data => {
      goods.value = data.result
    })
    return {
      goods
    }
  }
}
</script>

<style lang="less" scoped>
@import '../../../assets/styles/variable.less';
.goods-list {
  display: flex;
  justify-content: space-between;
  height: 300px;
  li {
    width: 200px;
    height: 300px;
    background: #f0f9f4;
    border-radius: 30px;
    .hoverShadow();
    img {
      width: 200px;
      height: 200px;
      border-radius: 30px;
    }
    p {
      font-size: 22px;
      padding: 12px 30px 0 30px;
      text-align: center;
    }
    .price {
      color: @priceColor;
    }
  }
}
</style>
